package com.flow.demo.module.gd.dal.mysql.address;


import com.flow.demo.framework.common.pojo.PageResult;
import com.flow.demo.framework.mybatis.core.mapper.BaseMapperX;
import com.flow.demo.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.flow.demo.module.gd.controller.admin.address.vo.AddressPageReqVO;
import com.flow.demo.module.gd.controller.admin.user.vo.GdUserPageReqVO;
import com.flow.demo.module.gd.dal.dataobject.address.AddressDO;
import com.flow.demo.module.gd.dal.dataobject.gduser.GdUserDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户地址 Mapper
 *
 * @author pompey_hpy
 */
@Mapper
public interface AddressMapper extends BaseMapperX<AddressDO> {

    default PageResult<AddressDO> selectPage(AddressPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AddressDO>()
                .eqIfPresent(AddressDO::getGdListId, reqVO.getGdListId())
                .eqIfPresent(AddressDO::getGdUserId, reqVO.getGdUserId())
                .likeIfPresent(AddressDO::getName, reqVO.getName())
                .eqIfPresent(AddressDO::getPhone, reqVO.getPhone())
                .eqIfPresent(AddressDO::getAddress, reqVO.getAddress())
                .betweenIfPresent(AddressDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AddressDO::getId));
    }


}